<template>
  <router-view>
  </router-view>
</template>

<script>
import websocket from "@/utils/websocket";

export default {
  name:'App',
  // 无空白reload添加：
  // provide() data():isRouterAlive methods:reload
  provide () {
    return {
      reload: this.reload
    }
  },
  data () {
    return {
      isRouterAlive: true,
    }
  },

  methods: {
    reload () {
      this.isRouterAlive = false
      this.$nextTick(function(){
        this.isRouterAlive = true
      })
    }
  },
  mounted(){
    window.reload = this.reload;
    // 获取本地token 如果有，则近期登录过，自动登录
    let token = window.sessionStorage.getItem('token');
    if(token){
      websocket.Init();
      // console.log(token);
    }
    else {
      console.log("no token")
    }

  },
  created() {

  },
};
</script>
<style>

</style>
